import React from 'react';
import './index.less';
import {connect} from "dva";
import BaseComponent from "components/Base/BaseComponent";
import {Descriptions} from "antd";


@connect(({patientInfo}) => ({patientInfo}))
export default class extends BaseComponent {

  getNamespace() {
    return 'patientInfo';
  }

  componentDidMount() {
    const {patientId} = this.props;
    this.dispatch({
      type: `${this.getNamespace()}/getPatientInfo`,
      payload: {
        notice: this.showMsg,
        patientId
      },
    })
  }

  render() {
    const {patientInfo} = this.props;

    const {patientId, name, sex, age, channel, simpleId, collectTime, cap, finishTime} = patientInfo.patientInfo;

    return (
      <Descriptions bordered layout="vertical" column={5} size="small">
        <Descriptions.Item label="就诊号">{patientId}</Descriptions.Item>
        <Descriptions.Item label="姓名">{name}</Descriptions.Item>
        <Descriptions.Item label="性别">{sex}</Descriptions.Item>
        <Descriptions.Item label="年龄">{age}</Descriptions.Item>
        <Descriptions.Item label="检验项目">{channel}</Descriptions.Item>
        <Descriptions.Item label="样本id">{simpleId}</Descriptions.Item>
        <Descriptions.Item label="样本量">{cap}</Descriptions.Item>
        <Descriptions.Item label="采集时间">{collectTime}</Descriptions.Item>
        <Descriptions.Item label="完成时间">{finishTime}</Descriptions.Item>
      </Descriptions>
    );
  }
}
